﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class DriverQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlCarrier;
        protected DropDownList ddlDriverCardNo;
        protected DropDownList ddlDriverCardTypeOper;
        protected DropDownList ddlDriverID;
        protected DropDownList ddlDriverName;
        protected DropDownList ddlIDCard;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddlTel;
        protected HtmlForm F2220;
        protected HtmlInputHidden hdnActionID;
        protected Label lblBu;
        protected Label lblCarrier;
        protected Label lblDriverCardNo;
        protected Label lblDriverCardType;
        protected Label lblDriverID;
        protected Label lblDriverName;
        protected Label lblIDCard;
        protected Label lblIsActive;
        protected Label lblStatus;
        protected Label lblTel;
        protected MultipleSelectControl MSCDriverCardType;
        protected MultipleSelectControl MSCStatus;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtCarrier;
        protected TextBox txtDriverCardNo;
        protected TextBox txtDriverID;
        protected TextBox txtDriverName;
        protected TextBox txtIDCard;
        protected TextBox txtTel;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DriverList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DriverList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.InitQueryDDL(this.ddlCarrier, 0);
            base.InitQueryDDL(this.ddlDriverCardTypeOper, 0);
            base.InitQueryDDL(this.ddlDriverCardNo, 0);
            base.InitQueryDDL(this.ddlDriverID, 0);
            base.InitQueryDDL(this.ddlTel, 0);
            base.InitQueryDDL(this.ddlDriverName, 0);
            base.InitQueryDDL(this.ddlIDCard, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitQueryDDL(this.ddlStatusOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
            base.BindData2DDLBySysCode(this.MSCStatus, "DriverStatus");
            this.ddlStatusOper.SelectedValue = "One Of";
            base.BindData2DDLBySysCode(this.MSCDriverCardType, "DriverLicenseType");
            this.ddlDriverCardTypeOper.SelectedValue = "One Of";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                    this.btnNew.Visible = false;
                    this.ddlIsActive.SelectedValue = "Y";
                    this.ddlIsActive.Enabled = false;
                }
            }
        }

        public string CarrierID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCarrier.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCarrier.Text.Trim(), this.ddlCarrier.SelectedValue);
                }
                return "";
            }
        }

        public string DriverCardNo
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDriverCardNo.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDriverCardNo.Text.Trim(), this.ddlDriverCardNo.SelectedValue);
                }
                return "";
            }
        }

        public string DriverCardType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCDriverCardType.ReturnValue))
                {
                    return base.GetParamsString(this.MSCDriverCardType.ReturnValue, this.ddlDriverCardTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string DriverID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDriverID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDriverID.Text.Trim(), this.ddlDriverID.SelectedValue);
                }
                return "";
            }
        }

        public string DriverName
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDriverName.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDriverName.Text.Trim(), this.ddlDriverName.SelectedValue);
                }
                return "";
            }
        }

        public string IDCard
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtIDCard.Text.Trim()))
                {
                    return base.GetParamsString(this.txtIDCard.Text.Trim(), this.ddlIDCard.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }

        public string Tel
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtTel.Text.Trim()))
                {
                    return base.GetParamsString(this.txtTel.Text.Trim(), this.ddlTel.SelectedValue);
                }
                return "";
            }
        }
    }
}

